package com.mall;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {
	@Bean
	Docket docker() {
		Docket docket = new Docket(DocumentationType.SWAGGER_2);
		
		ApiSelectorBuilder apis = docket.select().apis(RequestHandlerSelectors.basePackage("com.mall.controller"));
		
		ApiInfoBuilder apiInfo = new ApiInfoBuilder();
		apiInfo.title("商城API测试文档");
		apiInfo.version("v1.0");
		apiInfo.license("Apache 2.0");
		apiInfo.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0");
		apiInfo.description("商城接口测试文档");
		apiInfo.contact(new Contact("Admin", "http://www.admin.com", "admin@qq.com"));
		
		
		docket = apis.paths(PathSelectors.any()).build().apiInfo(apiInfo.build());
		
		return docket;
	}
}
